package com.neusoft.lohas.modules.ivm.enums.order;

public enum OrderTypeEnum {

	READY_FOR_DELIVERY(0, "等待派送", 0), 
	DELIVERYING(1, "正在派送", 1),
	DELIVERIED(2, "已派送", 2);

	private int type;
	private String desc;
	private int dbType;

	private OrderTypeEnum(int type, String desc, int dbType) {
		this.type = type;
		this.desc = desc;
		this.dbType = dbType;
	}

	public static OrderTypeEnum getEnumByStatus(int type, String... params) {
		OrderTypeEnum[] enums = OrderTypeEnum.values();
		for (OrderTypeEnum item : enums) {
			if (item.getType() == type)
				return item;
		}
		return null;
	}
	
	public static String getEnumOrderTypeDescByStatus(int type) {
		OrderTypeEnum[] enums = OrderTypeEnum.values();
		for (OrderTypeEnum item : enums) {
			if (item.getType() == type)
				return item.getDesc();
		}
		return null;
	}

	public static OrderTypeEnum getEnumByDbStatus(int dbType, String... params) {
		OrderTypeEnum[] enums = OrderTypeEnum.values();
		for (OrderTypeEnum item : enums) {
			if (item.getDbType() == dbType)
				return item;
		}
		return null;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public int getDbType() {
		return dbType;
	}

	public void setDbType(int dbType) {
		this.dbType = dbType;
	}
	
}
